define(["pageData","picNum","picSrc","jquery"],function(ajax,itemNum,pic,$){
	return function contentItemTab(content,conIndex){ //content是已经查找到的模块，后面的dom操作都是基于这个模块
		let itemTab = Array.from(document.getElementsByClassName("itemTab")[conIndex].children); //拿到所有itemTab的li，itemTab不是content的直接后代
		let spanFont = (content).getElementsByClassName("fontcontrol"); //拿到所有的content下的span
		let uls = (content).getElementsByClassName("uls")[0]; //拿到对应conten下的itemMsg
		let lis = Array.from($(".uls").children());
//		console.log(uls);
		let connum = conIndex;
		
		itemTab.forEach(function(item,index){
			item.addEventListener("mouseover",function(){ //鼠标划入
				//console.log(this.children)
				//更改样式
				spanFont[index].style.color = "#3A5883";
				spanFont[index].previousElementSibling.className = "";
				spanFont[index].previousElementSibling.previousElementSibling.className = "navHide";
				
				//显示商品
				//划过不同的span标签显示不同的商品
				//console.log(itemNum.homeNum[index]);
				ajax(itemNum.homeNum[index],conIndex);
				
				//显示不同的广告
				//console.log(pic.adPicSrc[index][0]);
				$(".type1 .moreContentMsg")[0].innerHTML = `
					<div class="left">
						<a href="#"><img src="${pic.adPicSrc[index][0]}"/></a>
					</div>
					<div class="right">
						<a href="#"><img src="${pic.adPicSrc[index][1]}"/></a>
					</div>
				`;
				
				
			})
			item.addEventListener("mouseout",function(){ //鼠标画出
				//console.log(this.children)
				
//				//移到商品上
//				lis.forEach(function(lis){
//					lis.addEventListener("mouseover",function(){
//					})
					lis.addEventListener("mouseout",function(){
						spanFont[index].style.color = "#616161";
						spanFont[index].previousElementSibling.className = "navHide";
//						spanFont[index].previousElementSibling.previousElementSibling.className = "";
//						
//					})
//				})
				
			})
		})
	}
})